package com.sinopac.model.SupervisorReconfirm;

import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import netfusion.jbranch.database.DataAccessManager;
import netfusion.jbranch.utils.bean.BeanUtil;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

import MyOTP.OTPAdapter;

import com.sinopac.entity.SupervisorReconfirm.JobQueuesVO;
import com.sinopac.entity.SupervisorReconfirm.SupvEntity;
import com.sinopac.model.TokenStorage.TokenStorageModel;
import com.sinopac.model.core.ModelCore;
import com.sinopac.util.XmlUtil;

public class SupervisorReconfirmModel extends ModelCore{
	private DataAccessManager dam;
	private Logger logger;
	private final static int apply_code = 1000;		//申請
	private final static int enable_code = 1001;	//啟用
	private final static int lock_code = 1002;		//暫禁
	private final static int unlock_code = 1003;	//解禁
	private final static int block_code = 1004;		//註銷
	private final static int batch_code = 2000;		//批次配發
	private final static int custody_code = 3000;	//token入庫
	private XmlUtil xmlUtil;
	
	/**
	 * 取得待覆核作業列表，依六類區分
	 * @return
	 */
	public SupvEntity getSupvList(){
		SupvEntity supvEntity = new SupvEntity();
		supvEntity.setApplyList(new ArrayList<JobQueuesVO>());
		supvEntity.setBatchList(new ArrayList<JobQueuesVO>());
		supvEntity.setCustodyList(new ArrayList<JobQueuesVO>());
		supvEntity.setInvalidList(new ArrayList<JobQueuesVO>());
		supvEntity.setPauseList(new ArrayList<JobQueuesVO>());
		supvEntity.setUnstallList(new ArrayList<JobQueuesVO>());
		supvEntity.setEnableList(new ArrayList<JobQueuesVO>());
		dam = new DataAccessManager();
		StringBuffer sql_sb = new StringBuffer();
		sql_sb.append("SELECT j.*, ");
		sql_sb.append("       c.customer_name ");
		sql_sb.append("FROM   job_queues j ");
		sql_sb.append("       LEFT JOIN customers c ");
		sql_sb.append("               ON j.customer_id = c.customer_id ");
		dam.setQueryString(sql_sb.toString());
		try {
			List<Map<String,Object>> jobList = dam.exeQueryMap();
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			if(!jobList.isEmpty()){
				for(Map<String,Object> map:jobList){
					int job_code = Integer.parseInt((String)map.get("job_code"));
					JobQueuesVO jobVO = BeanUtil.map2bean(map, JobQueuesVO.class);
					jobVO.setPermit(false);
					jobVO.setRefuse(false);
					jobVO.setDate(map.get("submitted_time")==null?"":sdf.format((Timestamp)map.get("submitted_time")));
					switch(job_code){
						case apply_code:
							supvEntity.getApplyList().add(jobVO);
							break;
						case enable_code:
							supvEntity.getEnableList().add(jobVO);
							break;
						case lock_code:
							supvEntity.getPauseList().add(jobVO);
							break;
						case unlock_code:
							supvEntity.getUnstallList().add(jobVO);
							break;
						case block_code:
							supvEntity.getInvalidList().add(jobVO);
							break;
						case batch_code:
							supvEntity.getBatchList().add(jobVO);
							break;
						case custody_code:
							supvEntity.getCustodyList().add(jobVO);
							break;
					}
				}
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return supvEntity;
	}
	/**
	 * 處理Entity將列表分類
	 * @param supventity
	 * @return
	 */
	public SupvEntity processSupvEntity(SupvEntity supventity){
		supventity.setTaskList(new ArrayList<JobQueuesVO>());
		supventity.setFileList(new ArrayList<JobQueuesVO>());
		if(supventity.getApplyList() != null){
			for(JobQueuesVO vo:supventity.getApplyList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("申請");
					supventity.getTaskList().add(vo);
				}
			}
		}
		if(supventity.getEnableList() != null){
			for(JobQueuesVO vo:supventity.getEnableList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("啟用");
					supventity.getTaskList().add(vo);
				}
			}
		}
		if(supventity.getPauseList() != null){
			for(JobQueuesVO vo:supventity.getPauseList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("暫禁");
					supventity.getTaskList().add(vo);
				}
			}
		}
		if(supventity.getUnstallList() != null){
			for(JobQueuesVO vo:supventity.getUnstallList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("解禁");
					supventity.getTaskList().add(vo);
				}
			}
		}
		if(supventity.getInvalidList() != null){
			for(JobQueuesVO vo:supventity.getInvalidList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("註銷");
					supventity.getTaskList().add(vo);
				}
			}
		}
		if(supventity.getBatchList() != null){
			for(JobQueuesVO vo:supventity.getBatchList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("批次申請");
					supventity.getFileList().add(vo);
				}
			}
		}
		if(supventity.getCustodyList() != null){
			for(JobQueuesVO vo:supventity.getCustodyList()){
				if(vo.getPermit() || vo.getRefuse()){
					vo.setJob_code_msg("TOKEN入庫");
					supventity.getFileList().add(vo);
				}
			}
		}
		return supventity;
	}
	
	public String updateDB(SupvEntity supventity,String manager){
		Date job_time = new Date();
		StringBuffer errorMsg = new StringBuffer();
		try {
			if(supventity.getTaskList()!=null&&!supventity.getTaskList().isEmpty()){
				for(JobQueuesVO vo:supventity.getTaskList()){
					boolean logFlag = false;
					int job_code_i = Integer.parseInt(vo.getJob_code());
					switch(job_code_i){
						case apply_code:
							logFlag = applyToken(vo);
							break;
						case enable_code:
							logFlag = enableToken(vo);
							break;
						case lock_code:
							logFlag = true;
							vo.setOtp_returncode(StringUtils.leftPad(String.valueOf(pauseToken(vo)),2,"0"));
							break;
						case unlock_code:
							logFlag = true;
							vo.setOtp_returncode(StringUtils.leftPad(String.valueOf(unstallToken(vo)),2,"0"));
							break;
						case block_code:
							logFlag = true;
							vo.setOtp_returncode(StringUtils.leftPad(String.valueOf(invalidToken(vo)),2,"0"));
							break;
					}
					if(logFlag){
						insertLogs(job_time,manager,vo);
					}
					updateJobQ(vo,errorMsg);
				}
			}
			if(supventity.getFileList()!=null&&!supventity.getFileList().isEmpty()){
				for(JobQueuesVO vo:supventity.getFileList()){
					boolean logFlag = false;
					int job_code_i = Integer.parseInt(vo.getJob_code());
					switch(job_code_i){
//					case batch_code:
//						BatchFileModel bfm = new BatchFileModel();
//						if(vo.getPermit()){
//							logFlag = bfm.csvReader(vo.getBatch_file(), vo.getJob_id());
//						}else if(vo.getRefuse()){
//							logFlag = deletejob_queues(vo.getJob_id()) > 0;
//						}						
//						break;
					case custody_code:
						TokenStorageModel tsm = new TokenStorageModel();
						if(vo.getPermit()){
							errorMsg.append(tsm.insertTokens(vo.getBatch_file(), vo.getJob_id()));
							logFlag = true;
						}else if(vo.getRefuse()){
							logFlag = deletejob_queues(vo.getJob_id()) > 0;
						}						
						break;
					}
//					System.out.println("logFlag:" + logFlag + "&" + vo.getJob_code());
					if(logFlag){
						insertLogs(job_time,manager,vo);
					}
				}
			}
		} catch (NumberFormatException e) {
			logger.error(e.getMessage());
			e.printStackTrace();
		} catch (SQLException e) {
			logger.error(e.getMessage());
			e.printStackTrace();
		}
		return errorMsg.toString();
	}
	/**
	 * 申請TOKEN
	 * @param vo
	 * @return
	 */
	private boolean applyToken(JobQueuesVO vo){
		boolean flag = false;
		try {
			if(vo.getPermit()){
				String related_to = StringUtils.isNotBlank(vo.getGroup_id())?vo.getGroup_id():vo.getCustomer_id();
				String is_group = StringUtils.isNotBlank(vo.getGroup_id())?"1":"0";
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				if(StringUtils.isNotBlank(vo.getGroup_id())){
					sql_sb.append("IF EXISTS(SELECT * FROM customers WHERE is_group_main = '1' and customer_id = :customer_id ) begin ");
					dam.setObject("customer_id", vo.getCustomer_id());
				}
				sql_sb.append("INSERT INTO token_customer ");
				sql_sb.append("            (token_esn, ");
				sql_sb.append("             related_to, ");
				sql_sb.append("             is_related_to_group, ");
				sql_sb.append("             related_to_time) ");
				sql_sb.append("VALUES      (:token_esn, ");
				sql_sb.append("             :related_to, ");
				sql_sb.append("             :is_group, ");
				sql_sb.append("             getdate()) ");
				if(StringUtils.isNotBlank(vo.getGroup_id())){
					sql_sb.append("end ");
				}
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				dam.setObject("related_to", related_to);
				dam.setObject("is_group", is_group);
				if(dam.exeUpdate()>0){
					flag = deletejob_queues(vo.getJob_id()) > 0;
					if(flag){
						updateTokens(vo.getToken_esn());
					}
				}
			}else if(vo.getRefuse()){
				flag = deletejob_queues(vo.getJob_id()) > 0;
				dam = new DataAccessManager();
				dam.setQueryString("update tokens set token_status = '00',is_receipt_printed = '0',receipt_printed_time = null where token_esn = :tokenEsn ");
				dam.setObject("tokenEsn", vo.getToken_esn());
				dam.exeUpdate();
//				if(flag){
//					updateTokens(vo.getToken_esn());
//				}
			}
		} catch (SQLException e) {
			logger.debug(e.getMessage());
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		return flag;
	}
	/**
	 * 啟用TOKEN
	 * @param vo
	 * @return
	 */
	private Boolean enableToken(JobQueuesVO vo){
		boolean flag = false;
		try {
			if(vo.getPermit()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = '01', ");
				sql_sb.append("       updated_time = Getdate(), ");
				sql_sb.append("       last_update_job = '1001' ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				if(dam.exeUpdate()>0){
					flag = deletejob_queues(vo.getJob_id()) > 0;
				}
			}else if(vo.getRefuse()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = :token_status, ");
				sql_sb.append("       updated_time = Getdate() ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				dam.setObject("token_status", vo.getToken_status());
				if(dam.exeUpdate()>0){
					flag = deletejob_queues(vo.getJob_id()) > 0;
//					if(flag){
//						updateTokens(vo.getToken_esn());
//					}
				}
			}
		} catch (SQLException e) {
			logger.debug(e.getMessage());
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		return flag;
	}
	/**
	 * 暫禁TOKEN
	 * @param vo
	 * @return
	 */
	private Integer pauseToken(JobQueuesVO vo){
		xmlUtil = new XmlUtil();
		Map<String,String> otpMap = xmlUtil.otpServer();
		OTPAdapter otp = new OTPAdapter();
		otp.openSession(otpMap.get(XmlUtil.OTP_IP), otpMap.get(XmlUtil.OTP_PORT), "", "", "10000");
		int random = (int)(Math.random()*1000);
		Integer otp_returncode = 0;
		boolean flag = false;
		try {
			if(vo.getPermit()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = '02', ");
				sql_sb.append("       updated_time = Getdate(), ");
				sql_sb.append("       last_update_job = '1002' ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				//2013-01-10 新增回傳參數判斷 by Shawn
				otp_returncode = otp.lockDevice(otpMap.get(XmlUtil.OTP_ISSUER), vo.getToken_esn(), "", String.valueOf(random));
				if(otp_returncode == 0){
					if(dam.exeUpdate()>0){
						flag = deletejob_queues(vo.getJob_id()) > 0;
					}
				}
				//2013-01-10 end
			}else if(vo.getRefuse()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = :token_status, ");
				sql_sb.append("       updated_time = Getdate() ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				dam.setObject("token_status", vo.getToken_status());
				if(dam.exeUpdate()>0){
					flag = deletejob_queues(vo.getJob_id()) > 0;
//					if(flag){
//						updateTokens(vo.getToken_esn());
//					}
				}
			}
		} catch (SQLException e) {
			logger.debug(e.getMessage());
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		return otp_returncode;
	}
	/**
	 * 解禁TOKEN
	 * @param vo
	 * @return
	 */
	private Integer unstallToken(JobQueuesVO vo){
		xmlUtil = new XmlUtil();
		Map<String,String> otpMap = xmlUtil.otpServer();
		OTPAdapter otp = new OTPAdapter();
		otp.openSession(otpMap.get(XmlUtil.OTP_IP), otpMap.get(XmlUtil.OTP_PORT), "", "", "10000");
		int random = (int)(Math.random()*1000);
		Integer otp_returncode = 0;
		boolean flag = false;
		try {
			if(vo.getPermit()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = '01', ");
				sql_sb.append("       updated_time = Getdate(), ");
				sql_sb.append("       last_update_job = '1003' ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				//2013-01-10 新增回傳參數判斷 by Shawn
				otp_returncode = otp.unlockDevice(otpMap.get(XmlUtil.OTP_ISSUER), vo.getToken_esn(), "", String.valueOf(random));
				if(otp_returncode == 0){
					if(dam.exeUpdate()>0){
						flag = deletejob_queues(vo.getJob_id()) > 0;
					}
				}
				//2013-01-10 end
			}else if(vo.getRefuse()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = :token_status, ");
				sql_sb.append("       updated_time = Getdate() ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				dam.setObject("token_status", vo.getToken_status());
				if(dam.exeUpdate()>0){
					flag = deletejob_queues(vo.getJob_id()) > 0;
//					if(flag){
//						updateTokens(vo.getToken_esn());
//					}
				}
			}
		} catch (SQLException e) {
			logger.debug(e.getMessage());
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		return otp_returncode;
	}
	/**
	 * 註銷TOKEN
	 * @param vo
	 * @return
	 */
	private Integer invalidToken(JobQueuesVO vo){
		xmlUtil = new XmlUtil();
		Map<String,String> otpMap = xmlUtil.otpServer();
		OTPAdapter otp = new OTPAdapter();
		otp.openSession(otpMap.get(XmlUtil.OTP_IP), otpMap.get(XmlUtil.OTP_PORT), "", "", "10000");
		int random = (int)(Math.random()*1000);
		Integer otp_returncode = 0;
		boolean flag = false;
		try {
			if(vo.getPermit()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = '03', ");
				sql_sb.append("       updated_time = Getdate(), ");
				sql_sb.append("       last_update_job = '1004' ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				otp_returncode = otp.blockDevice(otpMap.get(XmlUtil.OTP_ISSUER), vo.getToken_esn(), "", String.valueOf(random));
				if(otp_returncode == 0){
					if(dam.exeUpdate()>0){//註銷後刪除關聯
						dam = new DataAccessManager();
						sql_sb = new StringBuffer();
						sql_sb.append("delete from token_customer ");
						sql_sb.append("where  token_esn = :token_esn ");
						dam.setQueryString(sql_sb.toString());
						dam.setObject("token_esn", vo.getToken_esn());
//					dam.exeDelete();
						if(dam.exeDelete()>0){
							flag = deletejob_queues(vo.getJob_id()) > 0;
						}
//					flag = deletejob_queues(vo.getJob_id()) > 0;
					}
				}
			}else if(vo.getRefuse()){
				dam = new DataAccessManager();
				StringBuffer sql_sb = new StringBuffer();
				sql_sb.append("update tokens ");
				sql_sb.append("set    token_status = :token_status, ");
				sql_sb.append("       updated_time = Getdate() ");
				sql_sb.append("where  token_esn = :token_esn ");
				dam.setQueryString(sql_sb.toString());
				dam.setObject("token_esn", vo.getToken_esn());
				dam.setObject("token_status", vo.getToken_status());
				if(dam.exeUpdate()>0){
					flag = deletejob_queues(vo.getJob_id()) > 0;
//					if(flag){
//						updateTokens(vo.getToken_esn());
//					}
				}
			}
		} catch (SQLException e) {
			logger.debug(e.getMessage());
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		return otp_returncode;
	}
	
	private int deletejob_queues(String job_id) throws SQLException{
		dam = new DataAccessManager();
		StringBuffer sql_sb = new StringBuffer();
		sql_sb.append("DELETE FROM job_queues ");
		sql_sb.append("WHERE  job_id = :job_id ");
		dam.setQueryString(sql_sb.toString());
		dam.setObject("job_id", job_id);
		return dam.exeDelete();
	}
	
	/**
	 * update Tokens 的狀態為00(未啟用)
	 */
	public void updateTokens(String token_esn){
		DataAccessManager dam = new DataAccessManager();
		String sql = "UPDATE Tokens SET token_status ='00' WHERE token_esn = :token_esn ";
		dam.setObject("token_esn", token_esn);
		dam.setQueryString(sql);
		try {
			dam.exeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	private int insertLogs(Date log_time,String manager,JobQueuesVO vo) throws SQLException{
		dam = new DataAccessManager();
		StringBuffer sql_sb = new StringBuffer();
		sql_sb.append("IF NOT EXISTS(SELECT * FROM logs WHERE job_id = :job_id ) begin ");
		sql_sb.append("insert into logs ");
		sql_sb.append("            (log_time, ");
		sql_sb.append("             job_id, ");
		sql_sb.append("             job_code, ");
		sql_sb.append("             customer_id, ");
		sql_sb.append("             group_id, ");
		sql_sb.append("             token_esn, ");
		sql_sb.append("             batch_file, ");
		sql_sb.append("             batch_amount, ");
		sql_sb.append("             returncode, ");
		sql_sb.append("             operator, ");
		sql_sb.append("             manager, ");
		sql_sb.append("             comment, ");
		sql_sb.append("             otp_returncode) ");
		sql_sb.append("values      (:log_time, ");
		sql_sb.append("             :job_id, ");
		sql_sb.append("             :job_code, ");
		sql_sb.append("             :customer_id, ");
		sql_sb.append("             :group_id, ");
		sql_sb.append("             :token_esn, ");
		sql_sb.append("             :batch_file, ");
		sql_sb.append("             :batch_amount, ");
		sql_sb.append("             :returncode, ");
		sql_sb.append("             :operator, ");
		sql_sb.append("             :manager, ");
		sql_sb.append("             :comment, ");
		sql_sb.append("             :otp_returncode) end");
		sql_sb.append(" else ");
		sql_sb.append(" update logs set log_time = :log_time,job_code = :job_code,");
		sql_sb.append("returncode = :returncode,operator = :operator,manager = :manager,");
		sql_sb.append("comment = :comment,otp_returncode = :otp_returncode where job_id = :job_id ");
		dam.setQueryString(sql_sb.toString());
		dam.setObject("log_time", log_time);
		dam.setObject("job_id", StringUtils.trimToNull(vo.getJob_id()));
		dam.setObject("job_code", vo.getJob_code());
		dam.setObject("customer_id", StringUtils.trimToNull(vo.getCustomer_id()));
		dam.setObject("group_id", StringUtils.trimToNull(vo.getGroup_id()));
		dam.setObject("token_esn", StringUtils.trimToNull(vo.getToken_esn()));
		dam.setObject("batch_file", StringUtils.trimToNull(vo.getBatch_file()));
		dam.setObject("batch_amount", StringUtils.trimToNull(vo.getBatch_amount()));
		String returncode = "";
		if(vo.getPermit()){
			returncode = "核准";
		}else if(vo.getRefuse()){
			returncode = "拒絕";
		}
		dam.setObject("returncode", returncode);
		dam.setObject("operator", StringUtils.trimToNull(vo.getOperator()));
		dam.setObject("manager", manager);
		if(StringUtils.isBlank(vo.getOtp_returncode()) || StringUtils.equals(vo.getOtp_returncode(), "00")){
			dam.setObject("comment", StringUtils.trimToNull(vo.getComment()));
		}else {
			dam.setObject("comment", StringUtils.trimToNull("覆核失敗，錯誤代碼:"+vo.getOtp_returncode()+(StringUtils.isNotBlank(vo.getComment())?StringUtils.trimToEmpty("，"+vo.getComment()):"")));
		}
		dam.setObject("otp_returncode", StringUtils.trimToNull(vo.getOtp_returncode()));
		return dam.exeUpdate();
	}
	
	private void updateJobQ(JobQueuesVO vo,StringBuffer errorMsg) throws SQLException{
		if(StringUtils.isNotBlank(vo.getOtp_returncode()) && !StringUtils.equals(vo.getOtp_returncode(), "00")){
			dam = new DataAccessManager();
			String msg = "覆核失敗，錯誤代碼:"+vo.getOtp_returncode()+(StringUtils.isNotBlank(vo.getComment())?StringUtils.trimToEmpty("，"+vo.getComment()):"");
			errorMsg.append(String.format("客戶ID: %s  %s\r\n", vo.getCustomer_id(),"覆核失敗，錯誤代碼:"+vo.getOtp_returncode()));
			dam.setQueryString("update job_queues set comment = :comment where job_id = :job_id ");
			dam.setObject("comment", msg);
			dam.setObject("job_id", vo.getJob_id());
			dam.exeUpdate();
		}
	}
}
